<template>
  <el-form label-width="100px" class="songDetail">

    <el-row>
      <el-col :span="8">
        <el-form-item label="歌曲名称:">{{song.name}}</el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="8">
        <el-form-item label="歌手:">{{song.singer}}</el-form-item>
      </el-col>
    </el-row>

    <el-form-item>
      <el-button type="primary" @click="goBack">返 回</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import api from "@/api/api";

const SUCCESS = 0;
export default {
  data() {
    return {
      id: null,
      song: {}
    };
  },
  created() {
    let id = this.$route.query.id;
    if (id) {
      this.id = id;
      this._getDetail();
    }
  },
  methods: {
    _getDetail() {
      api.getDetail(this.id).then(response => {
        if (response.code == SUCCESS) {
          this.song = response.data.song;
        }
      });
    },
    goBack() {
      this.$router.back();
    }
  }
};
</script>

<style lang="less">
.songDetail {
  padding: 20px;
}
</style>